// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },
  ssr: true,
  modules: ['@element-plus/nuxt'],
  css: [
    'element-plus/dist/index.css',
    'element-plus/theme-chalk/display.css'
  ],
  runtimeConfig: {
    public: {
      // apiBase: import.meta.env.API_BASE_URL || 'http://localhost:8882/hualiang'
      apiBase: '/api'
    }
  },
  nitro: {
    routeRules:{
      '/api/**': {
        proxy: 'https://www.cngrain.com/hualiang/**'
        // proxy: 'http://localhost:8882/hualiang**'
      },
      // 本地
      '/net/**':{
        proxy: 'http://localhost:8882/hualiang/**'
      },
      // 数据中心接口
      '/datacenter/**':{
        // proxy: 'https://api.cngrain.com/hualiang/**',
        proxy: 'http://localhost:8881/hualiang/**'
      }
    }
  },
  plugins: [
    { src: '~/plugins/echarts.client.ts', mode: 'client' } // 仅在客户端加载
  ],
})
